<?php
namespace components;

class PException extends \Exception
{
	public static function throw($code, $msg = '')
	{
		$exceptionMsg = isset(Static::$msg[$code]) ? Static::$msg[$code] : 'unknow error';
		if ($msg) {
			$exceptionMsg = $msg;
		}
		\libs\URIProcess::dispatch([
			'code'    => $code,
			'message' => 'exception',
			'data'    => $exceptionMsg,
		]);
	}
}